home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7848 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: dawn.mmm.com!news
  2. From: kjhopps@mmm.com (Kevin J Hopps)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Q: 1 bit data type?
  5. Date: 19 Feb 1996 20:48:58 GMT
  6. Organization: 3M - St. Paul, MN  55144-1000 US
  7. Message-ID: <4gannq$4q7@dawn.mmm.com>
  8. References: <4g69if$edt@golden.ncw.net>
  9. Reply-To: kjhopps@mmm.com
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Kit Arbuckle (arbuckle@ncw.net) wrote:
  13. >     Does anyone know how to set up a data type that contains only one 
  14. > bit in BC452? I am currently using chars, but that is an awful waste of 
  15. > space to store a boolean value. I know I could use masking or shifting of 
  16. > bits, but this would be simpler. Thanks in advance...
  17.  
  18. In a structure you can use a bit field, but unless you have several bit
  19. fields in sequence in the same structure, the members on either side of
  20. it will be on addressable boundaries anyway.
  21.  
  22. Also, keep in mind that it probably takes more instructions to access a
  23. bit field than an entire char.  Depending on the relative proportions of
  24. data vs. the code to access it, it might actually cost more space in
  25. instructions than it saves in data.
  26. --
  27. Kevin J. Hopps                  e-mail: kjhopps@mmm.com
  28. 3M Company                      phone:  (612) 737-4643
  29. 3M Center, Bldg. 235-2D-57      fax:    (612) 737-2700
  30. St. Paul, MN 55144-1000         Opinions are my own.  I don't speak for 3M.
  31.     But 3M speaks for me -- I did not write the following line:
  32.  
  33. Opinions expressed herein are my own and may not represent those of 3M.
  34.